#include <dp8051xp.h>
#include <stdio.h>
#include "sys.h"
#include "ir.h"
#include "pannel.h"
#include "uart.h"
#include "pmu_rtc.h"
#include "pmu_cec.h"
#include <intrins.h>

void main(void)
{
	enum SHOW_TYPE show_type;	

	//init for normal mode
	pmu_init();   

	// wait mailbox interrupt come
	while(g_standby_flag != ENTER_STANDBY);

	g_standby_flag = NORMAL_STATUS;
	standby_init();  

	//get show type from cpu
	show_type=(enum SHOW_TYPE)(PMU_READ_BYTE(SHOW_TYPE_PAR));

	while(1)
	{
		//it will loop,until ir,pannel_key or time comeing          
		pannel_process(&g_rtc, show_type);
		rtc_process(&g_rtc,&g_wake_rtc);
		ir_process(&g_rtc);   
		pmu_cec_process(&g_rtc);
		ali_power_key_process(&g_rtc); // ali power for specil ,customer should not care it
	}
}

